package org.jivesoftware.spark;

import java.awt.GridBagConstraints;
import java.awt.Insets;

import javax.swing.JPanel;

import org.jivesoftware.spark.util.SwingWorker;

import cn.newgrand.netcall.advertisement.AdvertisementManager;

public class AdPanel extends JPanel {
	private JPanel adChatBottom;

	public AdPanel() {
		adChatBottom = new JPanel();
		// 聊天窗体底部添加广告面板
		SwingWorker swingWorker = new SwingWorker() {
			public Object construct() {
				try {
					adChatBottom = AdvertisementManager.getInstance()
							.getAdChatBottom();
					add(adChatBottom, new GridBagConstraints(0, 0, 1, 1, 0.0,
							0.0, GridBagConstraints.WEST,
							GridBagConstraints.WEST, new Insets(0, 0, 0, 10),
							0, 0));
					return true;
				} catch (Exception e) {
					// TODO: handle exception
					e.printStackTrace();
					return false;
				}
			}

			public void finished() {

			}
		};
		swingWorker.start();
	}

}
